﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BussinesCosea;
using System.Configuration;

public partial class BusquedaCandidato : System.Web.UI.Page
{

    private static AppSettingsReader settings = new AppSettingsReader();
    string cadena = (string)settings.GetValue("Conexion2", typeof(string));

    enum TipoBusqueda
    {
        todos = 0,
        criterios = 1
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack == false)
        {
            //buscaSolicitudes(TipoBusqueda.todos, "");
            //ModalPopupExtender1.DropShadow = true;
            //ModalPopupExtender1.Show();
        }
    }
       

    protected void btnConsultar_Click(object sender, EventArgs e)
    {
        cargaGrid();
    }

    private void cargaGrid()
    {
        string criterio = "";
        if (Documentacion_9.Checked)
            criterio = "";
        else
            criterio = cname.Value.Trim();
        using (BussinesCosea.CoseaDirectos c = new BussinesCosea.CoseaDirectos(cadena))
        {
            grdDatos.DataSource = c.BuscaSolEmpleo(criterio);
            grdDatos.DataBind();
        }
    }

    protected void grdDatos_SelectedIndexChanged1(object sender, EventArgs e)
    {
        //GridViewRow row =grdDatos.SelectedRow ;                
        //cname.Value = grdDatos.SelectedValue.ToString();
       //this.Server.Transfer("ResultadoBusqueda.aspx?id=" + grdDatos.SelectedValue.ToString());
       //this.Server.Transfer("ResultadoBusqueda.aspx");
       Response.Redirect("ResultadoBusqueda.aspx?id=" + grdDatos.SelectedValue.ToString());
    }
    protected void grdDatos_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grdDatos.PageIndex = e.NewPageIndex;
        cargaGrid();
    }
}